val doubleIt2: (Int) -> Int = { i: Int -> i * 2 }
fun func2a(i: Int): Int = doubleIt2.invoke(i)
fun func2b(i: Int): Int = doubleIt2(i)
Function Call | Return Value | |||
---|---|---|---|---|
func2a(5) | → | |||
func2a(10) | → | |||
func2b(20) | → | |||
func2b(25) | → |
Experiment with this code on Gitpod.io or as a Kotlin Playground